The present invention relates to an image processing apparatus and method, and its computer program product and, more particularly, to an image processing apparatus and method for binarizing a multi-valued image by determining a binarization threshold value used for binarizing a multi-valued image, and its computer program product.
In recent years, the image processing technique has advanced remarkably, and image processing apparatuses which can perform processing of multi-valued images such as full-color images including both pictures and characters, character recognition processing in multi-valued images, highly sophisticated numeric operation processing such as image processing, and the like have become popular.
In such image processing technique, binarization processing of multi-valued images including both pictures and characters is indispensable.
In one conventional binarization method, maximum and minimum values are calculated for each line or several lines of an original, and a binarization threshold value is determined on the basis of these maximum and minimum values to perform simple binarization. Also, in another method, a binarization threshold value is determined on the basis of the difference between the maximum and minimum values in units of blocks of an original to perform simple binarization. Furthermore, the Otsu's method is known. In this method, a threshold value corresponding to a maximum inter-class variance obtained when the histogram of an original is divided into two classes based on a certain threshold value is determined as a binarization threshold value (Otsu, "Automatic Threshold Value Selection Method Based on Discrimination and Least Square Criteria", Journal of Papers of The Institute of Electronics, Information and Communication Engineers, vol. J63-D, No. 4, pp. 349-356, 1980).
In the above-mentioned image processing technique, high-speed, high-precision numeric operation processing is indispensable upon determining the binarization threshold value in binarization processing of multi-valued images.
Conventionally, the numeric operation method on computers includes an integer operation and a floating-point operation. The integer operation is executed at high speed within the integer effective number range (from 32767 to -32768 for 16-bit integers) that can be processed by a computer, and is executed at higher speed within the internal integer effective number range (this depends on the processing environment such as a CPU, system, and the like) of the computer. On the other hand, since the floating-point operation is executed using numbers having a mantissa and an exponent, it can express various numbers from large numbers to decimal fractions.
However, the above-mentioned binarization methods in the conventional image processing apparatus suffer the following problems.
Upon binarizing an original which includes both picture and character portions in an image, in the method of performing binarization in units of lines of an original, since both the picture and character portions are present on an identical line, it is difficult to set a threshold value suitable for both the picture and character portions. As a consequence, if the threshold value is preferentially determined for the picture portion, the character portion is battered. On the other hand, when the threshold value is preferentially determined for the character portion, the picture portion is battered or blurred. In the method of performing binarization in units of blocks of an original, since it cannot be determined if data in each block corresponds to a picture region or a character region, it is difficult to set a threshold value suitable for both the picture and character portions, and the binarization result is battered or blurred. Since binarization processing is performed in units of blocks, block distortion is generated in the binarization result. Also, when a background portion is present in one block and a character portion is present in a block thereabove, even the background portion is reproduced to have density by binarization, and a binary image which has many noise components in the character portion is generated.
Furthermore, in the Otsu's method, when the picture and character portions have different features in the distributions of the two classes, and the distributions of the two classes are extremely different from each other, the threshold value tends to be offset to the larger class of the two and, hence, a binary image including many noise components is generated.
Even in determining a binarization threshold value in the binarization processing of multi-valued image, it is required to determine the binarization threshold value by a statistical calculation of the image histogram using the integer and floating-point operations.
The calculation method in determining the binarization threshold value has the following problems.
When a numeric operation for image processing is performed by the integer operation, the arithmetic operation speed is greatly higher than that in the floating-point operation. However, errors are generated since the decimal part is rounded off in, e.g., a division, and such errors are apt to accumulate when repetitive arithmetic operations include a division. As a consequence, high precision cannot be maintained. Also, the integer range is limited; the integer operation cannot process a large number beyond the range and a decimal fraction.
When a numeric operation for image processing is attained by the floating-point operation, high precision can be maintained, but the arithmetic operation speed is low, resulting in a long processing time.